<?php
/**
 * Created by PhpStorm.
 * User: bill-h
 * Date: 2023/4/21
 * Time: 11:08
 * Email: 391878487@qq.com
 */
namespace  Bill\Packagetest;
class Code
{
    /**
     * 获取编号
     *
     */
    public function getSn($type = 0)
    {
        switch ($type) {
            case 1:         //订单编号
                $str = $type . substr(msectime() . rand(0, 9), 1);
                break;
            case 2:         //商品编号
                $str = 'G' . substr(msectime() . rand(0, 5), 1);
                break;
            default:        //默认编号
                $str = substr(msectime() . rand(0, 5), 1);
        }
        return $str;
    }

}